/** 
 * @js 基本数据类型: 
 * @param {Number, String, BigInt, Boolean, null, undefined, Symbol}
 * @param {Object} */
let a = 12, 
c = "123", 
b = false, 
d = null, 
e = undefined, 
f = { a: 0, b: 9, c: 8 },
g = Symbol("sym"),
h = function say(params) {
    console.log("i am a function")
},
i = [1,2,3,4,5,6];
/**
 * @symbol
 *  */
let s = Symbol('707')
/**
 * Symbol.for()
 * Symbol.keyFor() */   

/**
 * @一
 * @tostring 
 *  */ 
console.log(Object.prototype.toString.call(a))
console.log(Object.prototype.toString.call(b))
console.log(Object.prototype.toString.call(c))
console.log(Object.prototype.toString.call(d))
console.log(Object.prototype.toString.call(e))
console.log(Object.prototype.toString.call(f))
console.log(Object.prototype.toString.call(g))
console.log(Object.prototype.toString.call(h))
/*  [object Number]  
    [object Boolean]
    [object String]
    [object Null]
    [object Undefined]
    [object Object]
    [object Symbol]
    [object Function] */
/**
 * @二
 * @instanceof
 * @typeof 
 * @注 
 * 判断数组
 *  */
console.log("typeof null ",typeof null)   
console.log("typeof array ",typeof [1,2,3])   
console.log("typeof function ", typeof h)
console.log(h.prototype)
function getType(o) {
    let res = typeof o
    if(!o && res === "object") return "null";
    // if(Array.isArray(o)) return "array"
    if(o instanceof Array) return "array"
    return res
}
function myInstanceof(instance, func) {
    if(typeof func !== "function") throw Error("not a function")
    const pro = func.prototype
    let instancePro = instance.__proto__
    while(instancePro){
        if(instancePro === pro) return true
        instancePro = instancePro.__proto__
    }
    return false
}
console.log("myInstanceof test ", myInstanceof(f, Array))
/**
 * @prototype
 * function 有 prototype {constructor   --> function}
 * @__proto__
 * 实例 有 __proto__ 指向 prototype
 * @constructor
 * 原型上有 constructor 
 */ 
    




